//
// GJPromoPopup::init from 0x1402a4c50 to 0x1402a4f45 (757 bytes)
//
// 2 xrefs:
// > CreatorLayer::onAdventureMap @ 0x14009e35a
// > ??> @ 0x1406d2048
//
// 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
char __fastcall GJPromoPopup::init(__int64 a1, _QWORD *a2)
{
__int64 v2; // r15
const char *v4; // rbx
const char *v5; // rdi
cocos2d::CCTextureCache *v6; // rax
__int64 v7; // rcx
__int64 v8; // rax
cocos2d::CCTouchDispatcher *v9; // rax
__int64 v10; // rdx
__int64 v12; // rdx
__int64 v13; // rcx
cocos2d::CCDirector *v14; // rax
__int64 v15; // rax
struct cocos2d::CCSprite *v16; // rsi
float v17; // xmm0_4
cocos2d::CCSprite_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
struct cocos2d::CCSprite *v20; // rax
CCMenuItemSpriteExtra *v21; // rax
struct cocos2d::CCMenu *v22; // rax
cocos2d::CCMenu_vtbl *v23; // rdi
float v24; // xmm7_4
float *v25; // rbx
float v26; // xmm0_4
const cocos2d::CCPoint *v27; // rax
int v28; // [rsp+20h] [rbp-78h] BYREF
float v29; // [rsp+28h] [rbp-70h]
_QWORD *v30; // [rsp+30h] [rbp-68h]
v2 = (__int64)a2;
v30 = a2;
v4 = (const char *)(a1 + 632);
if ( (_QWORD *)(a1 + 632) != a2 )
{
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
sub_14003CCE0((void **)(a1 + 632), a2, *(_QWORD *)(v2 + 16));
}
v5 = v4;
if ( *((_QWORD *)v4 + 3) > 0xFu )
v5 = *(const char **)v4;
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, v5, 0);
if ( !*(_BYTE *)(a1 + 628) )
{
*(_BYTE *)(a1 + 628) = 1;
v8 = cocos2d::CCDirector::sharedDirector(v7);
v9 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 144LL))(v8);
cocos2d::CCTouchDispatcher::registerForcePrio(v9, (struct cocos2d::CCObject *)a1, 2);
}
v28 = -1358954496;
if ( cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v28) )
{
LOBYTE(v10) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 904LL))(a1, v10);
LOBYTE(v12) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 976LL))(a1, v12);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v13);
cocos2d::CCDirector::getWinSize(v14);
v15 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 576) = v15;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 448LL))(a1, v15);
if ( *((_QWORD *)v4 + 3) > 0xFu )
v4 = *(const char **)v4;
v16 = cocos2d::CCSprite::create(v4);
v17 = (*(float (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 576) + 440LL))(
*(_QWORD *)(a1 + 576),
v16,
0xFFFFFFFFLL);
v18 = v16->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v17, v29 * 0.5);
v18->setPosition_0(v16, v19);
*(_DWORD *)(a1 + 624) = -1;
v20 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v21 = CCMenuItemSpriteExtra::create(
v20,
nullptr,
(cocos2d::CCObject *)a1,
(cocos2d::SEL_MenuHandler *)GJPathRewardPopup::closePopup);
HIDWORD(v21->m_pfnSelector.adj) = 1070386381;
v22 = cocos2d::CCMenu::create(v21, 0);
*(_QWORD *)(a1 + 544) = v22;
v23 = v22->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16->getContentSize(v16);
v16->getScale(v16);
v24 = v29 * 0.5;
v25 = (float *)v16->getContentSize(v16);
v26 = (float)(v16->getScale(v16) * *v25) * 0.5;
cocos2d::CCPoint::CCPoint(v26, (float)(v24 - v26) + 12.0);
v23->setPosition_0(*(cocos2d::CCNode **)(a1 + 544), v27);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 576) + 440LL))(
*(_QWORD *)(a1 + 576),
*(_QWORD *)(a1 + 544),
10);
sub_14003A830(v2);
return 1;
}
else
{
sub_14003A830(v2);
return 0;
}
}