//
// GJPathSprite::create from 0x140289050 to 0x1402891e0 (400 bytes)
//
// 6 xrefs:
// > GJItemIcon::init @ 0x14027b097
// > GJPathsLayer::init @ 0x140285017
// > GJPathPage::init @ 0x140285de1
// > GJPathPage::playUnlockAnimation @ 0x140287ef3
// > GJPathPage::unlockAnimationStep3 @ 0x1402886be
// > ??> @ 0x1406d15f8
//
// 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
GJPathSprite *GJPathSprite::create(int a1)
{
GJPathSprite *v2; // rbx
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // r8
void **v6; // rdx
void *v7; // rcx
void *v8; // rcx
void *Block[2]; // [rsp+28h] [rbp-30h] BYREF
__int64 v11; // [rsp+38h] [rbp-20h]
unsigned __int64 v12; // [rsp+40h] [rbp-18h]
v2 = (GJPathSprite *)operator new(0x260u);
memset(v2, 0, sizeof(GJPathSprite));
cocos2d::CCSprite::CCSprite(v2);
v2->CCSpriteCOpacity::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (GJPathSprite_vtbl *)&GJPathSprite::`vftable';
v2->CCSpriteCOpacity::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&GJPathSprite::`vftable';
v2->CCSpriteCOpacity::cocos2d::CCSprite::cocos2d::CCTextureProtocol::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCTextureProtocol_vtbl *)&GJPathSprite::`vftable';
v3 = cocos2d::CCString::createWithFormat("pathIcon_%02d_001.png", a1);
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)Block = 0;
v11 = 0;
v12 = 0;
v5 = -1;
do
++v5;
while ( CString[v5] );
sub_14003A930(Block, CString, v5);
v6 = Block;
if ( v12 > 0xF )
v6 = (void **)Block[0];
if ( cocos2d::CCSprite::initWithSpriteFrameName(v2, (const char *)v6) )
{
v2->m_pathNumber = a1;
if ( v12 > 0xF )
{
v8 = Block[0];
if ( v12 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
goto LABEL_14;
}
j_j_free(v8);
}
cocos2d::CCObject::autorelease(v2);
return v2;
}
if ( v12 > 0xF )
{
v7 = Block[0];
if ( v12 + 1 < 0x1000
|| (v7 = *((void **)Block[0] - 1), (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) <= 0x1F) )
{
j_j_free(v7);
goto LABEL_10;
}
LABEL_14:
invalid_parameter_noinfo_noreturn();
}
LABEL_10:
((void (__fastcall *)(GJPathSprite *, __int64))v2->~GJPathSprite)(v2, 1);
return nullptr;
}