//
// sub_140048500 from 0x140048500 to 0x1400485f4 (244 bytes)
//
// 5 xrefs:
// > GJShopLayer::init @ 0x1402aa35d
// > GJShopLayer::init @ 0x1402aa768
// > RewardUnlockLayer::init @ 0x1403ce24c
// > SecretLayer5::init @ 0x1403f4870
// > ??> @ 0x1406c4b84
//
// 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=1
CCSpriteWithHue *__fastcall sub_140048500(__int64 a1)
{
const char *v1; // rbx
cocos2d::CCSpriteFrameCache *v2; // rax
cocos2d::CCSpriteFrame *v3; // rdi
CCSpriteWithHue *v4; // rax
CCSpriteWithHue *v5; // rbx
bool (*initWithSpriteFrame)(CCSpriteWithHue *, cocos2d::CCSpriteFrame *); // r8
v1 = (const char *)a1;
if ( *(_QWORD *)(a1 + 24) > 0xFu )
v1 = *(const char **)a1;
v2 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v3 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v2, v1);
v4 = (CCSpriteWithHue *)operator new(0x298u, (const struct std::nothrow_t *)&unk_1405188C0);
v5 = v4;
if ( v4 )
{
memset(v4, 0, sizeof(CCSpriteWithHue));
cocos2d::CCSprite::CCSprite(v5);
v5->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (CCSpriteWithHue_vtbl *)&CCSpriteWithHue::`vftable';
v5->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&CCSpriteWithHue::`vftable';
v5->cocos2d::CCSprite::cocos2d::CCTextureProtocol::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCTextureProtocol_vtbl *)&CCSpriteWithHue::`vftable';
}
else
{
v5 = nullptr;
}
if ( v5 )
{
if ( v3 )
{
initWithSpriteFrame = (bool (*)(CCSpriteWithHue *, cocos2d::CCSpriteFrame *))v5->initWithSpriteFrame;
if ( initWithSpriteFrame == CCSpriteWithHue::initWithSpriteFrame
? CCSpriteWithHue::initWithSpriteFrame(v5, v3)
: initWithSpriteFrame(v5, v3) )
{
cocos2d::CCObject::autorelease(v5);
return v5;
}
}
((void (__fastcall *)(CCSpriteWithHue *, __int64))v5->~CCSpriteWithHue)(v5, 1);
}
return nullptr;
}