//
// GJPromoPopup::init from 0x8d986c to 0x8d9ad8 (620 bytes)
//
// 2 xrefs:
// > GJPromoPopup::create @ 0x8d9bc4
// > ??> @ 0xacd70
//
// 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
//
__int64 __fastcall GJPromoPopup::init(__int64 a1, __int64 a2)
{
cocos2d::CCTextureCache *v3; // x0
unsigned __int8 v4; // w0
unsigned int v5; // w23
cocos2d::CCDirector *v6; // x0
cocos2d::CCLayer *v7; // x0
const char *v8; // x1
__int64 v9; // x21
void (__fastcall *v10)(__int64, cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v11; // x0
CCMenuItemSpriteExtra *v12; // x24
__int64 v13; // x24
__int64 v14; // x1
void (__fastcall *v15)(__int64, cocos2d::CCPoint *); // x25
float v16; // s10
float v17; // s13
float v18; // s9
float v19; // s0
float v21; // [xsp+88h] [xbp+88h]
float v22; // [xsp+8Ch] [xbp+8Ch]
cocos2d::CCPoint v23; // [xsp+90h] [xbp+90h] BYREF
cocos2d::SEL_MenuHandler v24; // 0:x2.16
sub_D18EA8(a1 + 632, a2);
v3 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v3, *(const char **)(a1 + 632), 0);
FLAlertLayer::incrementForcePrio((FLAlertLayer *)a1);
v23.x = -1.1642e-10;
v4 = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const cocos2d::_ccColor4B *)&v23);
v5 = v4;
if ( v4 )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 984LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1056LL))(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 576) = v7;
(*(void (__fastcall **)(__int64, cocos2d::CCLayer *))(*(_QWORD *)a1 + 440LL))(a1, v7);
v9 = cocos2d::CCSprite::create(*(cocos2d::CCSprite **)(a1 + 632), v8);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v9,
0xFFFFFFFFLL);
v10 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v9 + 184LL);
cocos2d::CCPoint::CCPoint(&v23, v21 * 0.5, v22 * 0.5);
v10(v9, &v23);
*(_DWORD *)(a1 + 624) = -1;
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v24.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v24.adj = (size_t)GJPromoPopup::onClose;
v12 = CCMenuItemSpriteExtra::create(v11, nullptr, v24);
CCMenuItemSpriteExtra::setSizeMult(v12, 1.6);
v13 = cocos2d::CCMenu::create((cocos2d::CCMenu *)v12, nullptr);
v14 = *(_QWORD *)v9;
*(_QWORD *)(a1 + 544) = v13;
v15 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v13 + 184LL);
v16 = *(float *)(*(__int64 (__fastcall **)(__int64))(v14 + 312))(v9);
v17 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v9 + 168LL))(v9);
v18 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 312LL))(v9) + 4);
v19 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v9 + 168LL))(v9);
cocos2d::CCPoint::CCPoint(
&v23,
12.0 - (float)((float)((float)(v16 * v17) * 0.5) - (float)(v21 * 0.5)),
(float)((float)((float)(v18 * v19) * 0.5) + (float)(v22 * 0.5)) - 12.0);
v15(v13, &v23);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
*(_QWORD *)(a1 + 544),
10);
}
return v5;
}