//
// GJPromoPopup::init from 0x1002b6480 to 0x1002b66f2 (626 bytes)
//
// 1 xrefs:
// > GJPromoPopup::create @ 0x1002b6414
//
// 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 GJPromoPopup::init(__int64 a1, const std::string *a2)
{
cocos2d::CCTextureCache *v3; // rax
const char *v4; // rsi
bool result; // al
bool v6; // r12
cocos2d::CCLayer *v7; // rax
const char *v8; // rdi
cocos2d::CCSprite *v9; // r14
cocos2d::CCSprite *v10; // rax
CCMenuItemSpriteExtra *v11; // rax
int v12; // r15d
int v13; // edx
int v14; // ecx
int v15; // r8d
int v16; // r9d
__int64 v17; // r15
float v18; // xmm0_4
float v19; // xmm0_4
float v20[2]; // [rsp+4h] [rbp-3Ch] BYREF
float v21; // [rsp+Ch] [rbp-34h]
float v22; // [rsp+10h] [rbp-30h] BYREF
float v23; // [rsp+14h] [rbp-2Ch]
float v24; // [rsp+18h] [rbp-28h]
float v25; // [rsp+1Ch] [rbp-24h]
double v26; // 0:xmm0_8.8
std::string::operator=((std::string *)(a1 + 632), a2);
v3 = cocos2d::CCTextureCache::sharedTextureCache();
if ( (*(_BYTE *)(a1 + 632) & 1) != 0 )
v4 = *(const char **)(a1 + 648);
else
v4 = (const char *)(a1 + 633);
cocos2d::CCTextureCache::addImage(v3, v4, 0);
FLAlertLayer::incrementForcePrio((FLAlertLayer *)a1);
v22 = -1.1641532e-10;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const cocos2d::ccColor4B *)&v22);
if ( result )
{
v6 = result;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 984LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1056LL))(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v26 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v22);
v7 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 576) = v7;
(*(void (__fastcall **)(__int64, cocos2d::CCLayer *, double))(*(_QWORD *)a1 + 440LL))(a1, v7, v26);
if ( (*(_BYTE *)(a1 + 632) & 1) != 0 )
v8 = *(const char **)(a1 + 648);
else
v8 = (const char *)(a1 + 633);
v9 = cocos2d::CCSprite::create_1(v8);
(*(void (__fastcall **)(_QWORD, cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v9,
0xFFFFFFFFLL);
sub_10028CBE0(v20, v22 * 0.5, v23 * 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v9->setPosition)(v9, v20);
*(_DWORD *)(a1 + 624) = -1;
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v11 = CCMenuItemSpriteExtra::create(
v10,
nullptr,
(cocos2d::CCObject *)a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJPromoPopup::onClose);
v12 = (int)v11;
CCMenuItemSpriteExtra::setSizeMult(v11, 1.6);
v17 = sub_100792C50(v12, 0, v13, v14, v15, v16);
*(_QWORD *)(a1 + 544) = v17;
v24 = v22 * 0.5;
v25 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v9->getContentSize)(v9);
v18 = ((float (__fastcall *)(cocos2d::CCSprite *))v9->getScale)(v9);
v24 = (float)(v24 - (float)((float)(v18 * v25) * 0.5)) + 12.0;
v25 = v23 * 0.5;
v21 = *(float *)(((__int64 (__fastcall *)(cocos2d::CCSprite *))v9->getContentSize)(v9) + 4);
v19 = ((float (__fastcall *)(cocos2d::CCSprite *))v9->getScale)(v9);
sub_10028CBE0(v20, v24, (float)((float)((float)(v21 * v19) * 0.5) + v25) + -12.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v17 + 184LL))(v17, v20);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
*(_QWORD *)(a1 + 544),
10);
return v6;
}
return result;
}